﻿using CommunityToolkit.Mvvm.ComponentModel;
using HandyControl.Tools.Extension;
using P002_SudukuSolver_Mvvm.Services;
using P002_SudukuSolver_Mvvm.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace P002_SudukuSolver_Mvvm.Commands
{
    public class CreateExampleCommand : ICommand
    {
        public event EventHandler? CanExecuteChanged;

        public string Level { get; set; }

        public bool CanExecute(object? parameter)
        {
            return true;
        }

        public void Execute(object? parameter)
        {
            if (parameter is string p)
            {
                MainWindowViewModel viewModel = MainWindowViewModel.Instance;
                if (viewModel == null) return;
                if (p == "level1")
                {
                    viewModel.SudukuViewModel.SetNewSuduku(GetExamples.level1);
                }
                else
                {
                    viewModel.SudukuViewModel.SetNewSuduku(GetExamples.level2);
                }
            }
        }
    }
}
